<?php
/**
 * *********************************************************************************************************************
 * 派件清单
 * *********************************************************************************************************************
 */
namespace soa\delivery;
use soa\client;

class zt extends client
{
    /**
     * @var string
     */
    public $service_url = 'http://express.core.kuaidihelp.com';

    /**
     * @var string
     */
    public $service_name = 'kuaidihelp_express';

    /**
     * http 请求超时时间
     * @var int
     */
    protected $_timeout = 50;
    

    /**
     * 清单列表
     * @param string $branchId
     * @param string $empNo
     * @param string $beginDate
     * @param string $endDate
     * @param string $mobile　业务员手机号
     * @return array|mixed
     */
    public function getDeliveryList($branchId, $empNo, $beginDate, $endDate, $mobile, $type='', $appVersion=0)
    {
        if(empty($empNo))
            return array();

        $beginDate = $beginDate ? date('Y-m-d H:i:s', strtotime($beginDate)) : date('Y-m-d 00:00:00');
        $endDate = $endDate ? date('Y-m-d H:i:s', strtotime($endDate)) : date('Y-m-d 23:59:59');
        
        $result = $this->post('/v1/parter/zt/getDeliveryList', array(
            'branchId' => $branchId,
            'empNo' => $empNo,
            'beginDate' => $beginDate,
            'endDate' => $endDate,
            'mobile' => $mobile,
            'type' => $type,
            'appVersion' => $appVersion,
        ));
        return $result;
    }

    /**
     * 签收操作
     * @param $waybillDatas
     * @param $empNo
     * @param $source
     * @return bool|null|string
     */
    public function sign($waybillDatas, $empNo, $source)
    {
        if(empty($waybillDatas) || empty($empNo) || empty($source))
            return false;

        return $this->post('/v1/parter/zt/sign', array('waybillDatas' => $waybillDatas, 'empNo' => $empNo, 'source' => $source));
    }

    /**
     * 问题件操作
     * @param $waybillDatas
     * @param $empNo
     * @param $source
     * @return bool|null|string
     */
    public function problem($waybillDatas, $empNo, $source)
    {
        if(empty($waybillDatas) || empty($empNo) || empty($source))
            return false;

        return $this->post('/v1/parter/zt/problem', array('waybillDatas' => $waybillDatas, 'empNo' => $empNo, 'source' => $source));
    }

    /**
     * 派件操作
     * @param $waybillDatas
     * @param $empNo
     * @param $source
     * @return bool|null|string
     */
    public function send($waybillDatas, $empNo, $source)
    {
        if(empty($waybillDatas) || empty($empNo) || empty($source))
            return false;

        return $this->post('/v1/parter/zt/send', array('waybillDatas' => $waybillDatas, 'empNo' => $empNo, 'source' => $source));
    }
}